%{
#include <stdio.h>
extern int yylex();
extern void yyerror();
%}

%token '\n' '+' '/' '*' '(' ')'
%token <intVal> NB
%type <intVal> Expression List
%union {
  int intVal;
}
%left '+' '-'
%left '*' '/'

%%
List:
    | List Expression '\n' { $$=$2; printf("Valeur:%i",$2); }
    ;

Expression: Expression '*' Expression  { $$=$1*$3; /* printf("*= %i | ",$$); */ }
          | Expression '+' Expression  { $$=$1+$3; /* printf("+= %i | ",$$); */ }
          | Expression '-' Expression  { $$=$1-$3; /* printf("-= %i | ",$$); */ }
          | Expression '/' Expression  { $$=$1/$3; /* printf("/= %i | ",$$); */ }
          | '(' Expression ')' { $$=$2; }
          | NB { $$=$1; /* printf("Test NB = %d",$1); */ }
          ;

%%
